from django.apps import AppConfig

from django.db.models.signals import post_migrate


def auto_increment_start(sender, **kwargs):
    from .models import Room
    from django.db import connection
    table_name = Room._meta.db_table
    cursor = connection.cursor()
    cursor.execute("ALTER table {} AUTO_INCREMENT={}".format(table_name, 10000))


class RoomsConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'rooms'

    def ready(self):
        post_migrate.connect(auto_increment_start, sender=self)

